import React from 'react'
import {bindActionCreators} from'redux'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import LoginText from '../components/LoginText'
import * as TodoActions from '../actions';

const Login = ({login,actions}) => (
  <div>
    <LoginText fetchAction = {actions.fetchAction} login = {login}/>
  </div>
) 

Login.propTypes = {
  login:PropTypes.object.isRequired,
  actions:PropTypes.object.isRequired,
}

const mapStateToProps = state =>{
  return{
  login:state.login
}
}

const mapDispatchToProps = dispatch =>({
  actions:bindActionCreators(TodoActions,dispatch)
})


export default connect(mapStateToProps,mapDispatchToProps)(Login)
